package january.test_1_31;

public class Board {
    public boolean checkWon(int[][] board) {
        // write code here
        for (int i = 0; i < 3; i++) {
            int count = 0;
            for (int j = 0; j < 3; j++) {
                count += board[i][j];
            }
            if(count == 3) {
                return true;
            }
        }
        for (int i = 0; i < 3; i++) {
            int count = 0;
            for (int j = 0; j < 3; j++) {
                count += board[j][i];
            }
            if(count == 3) {
                return true;
            }
        }
        if(board[0][0] + board[1][1] + board[2][2] == 3) {
            return true;
        }
        if(board[0][2] + board[1][1] + board[2][0] == 3) {
            return true;
        }
        return false;
    }
}
